package apipractice;

import object.Point;

import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @description: TODO
 * @author yumo
 * @version: 1.0
 * @date 2025/3/13 18:11
 */
public class SortInteger1 {
    public static void main(String[] args) {
        List<Integer>abc=new ArrayList<>();
        Random rand=new Random();
        for (int i=0;i<10;i++){
            abc.add(rand.nextInt(100));
        }
        System.out.println(abc);
        Collections.sort(abc);
        System.out.println(abc);
        Collections.reverse(abc);
        System.out.println(abc);


        List<String>bb=new ArrayList<>();
        bb.add("savfh");
        bb.add("gddgsg");
        bb.add("fcgx");
        bb.add("x");
        Collections.sort(bb);
        Collections.sort(bb, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o1.length()-o2.length();
            }
        });
        List<Point>aa=new ArrayList<>();

        aa.add(new Point(10, 2));
        aa.add(new Point(65, 4));
        aa.add(new Point(34, 8));
        aa.add(new Point(37, 2));
        Collections.sort(aa, new Comparator<Point>() {
            @Override
            public int compare(Point o1, Point o2) {
                return o1.getX()-o2.getX();
            }
        });
        System.out.println(aa);

        List<String >e=new ArrayList<>();
        Collections.sort(e, ( o1,  o2) ->o1.length()-o2.length());


    }
}
